Skip to content

Move file-and-directory-entries out of drafts #2633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ddbeck
Copy link
Collaborator

@ddbeck ddbeck commented Feb 11, 2025

This is an extremely old draft feature that we added almost at the very beginning. It kinda works still but overlapping keys are a bit of a fuss.

See also: #2632

@ddbeck ddbeck requested a review from foolip February 11, 2025 12:00
@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Feb 11, 2025
Copy link
Collaborator

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The computed Baseline status is false. Is that because some part of this is deprecated? Or we need compute_from?

@ddbeck
Copy link
Collaborator Author

ddbeck commented Feb 20, 2025

The MDN page for this API mentions two main entry points — via api.DataTransferItem.webkitGetAsEntry and api.HTMLInputElement.webkitEntries — neither of which are Baseline-eligible because neither is supported on Firefox for Android (nor is the related drag and drop API). There are some interfaces exposed on Firefox for Android, though I'm unsure on what utility it would have with some of the pieces missing.

@ddbeck
Copy link
Collaborator Author

ddbeck commented Feb 28, 2025

Hmm, this might also be broken in Chrome too? See mdn/browser-compat-data#19304

@ddbeck ddbeck marked this pull request as draft May 12, 2025 12:42
@captainbrosset
Copy link
Contributor

Hmm, this might also be broken in Chrome too? See mdn/browser-compat-data#19304

Looks like the interface names are different between Firefox and Chromium: dropping files on an <input type=file> leads to FileEntry objects in Chromium, whereas it creates FileSystemFileEntry objects in Firefox (I have not tested in Safari).

The spec disagrees with Chromium: https://wicg.github.io/entries-api/#api-fileentry
See these discussions about changing the interface names: https://groups.google.com/a/chromium.org/g/blink-dev/c/_6Euwqv366U and WICG/entries-api#6.

That said, this code works both in Chromium and Firefox, irrespective of the interface names:

<!DOCTYPE html>

<label for="file-input">Drop files on the input</label>
<input type="file" id="file-input" multiple>

<script>
  const inputEl = document.getElementById('file-input');
  inputEl.addEventListener('change', function(event) {
    const entries = inputEl.webkitEntries;
    console.log(entries);
  });
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants